package com.financial.sys.controller.repayment;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.financial.sys.service.repayment.TRepaymentDetailService;
import com.financial.sys.vo.repayment.TRepaymentDetailQuery;
import com.financial.common.vo.JsonResult;
import com.financial.common.vo.PageResult;
import com.financial.common.vo.ResponseCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hzy
 * @since 2020-02-12
 */
/**
 *  收款明细
 */
@RestController
@RequestMapping("/finance/repayment/detail")
public class TRepaymentDetailController {

    @Autowired
    TRepaymentDetailService TRepaymentDetailService;
    @PostMapping("/query")
    public JsonResult query(TRepaymentDetailQuery TRepaymentDetailQuery){
        JsonResult jsonResult = new JsonResult();
        try{
            IPage query = TRepaymentDetailService.query(TRepaymentDetailQuery);
            PageResult pageResult = new PageResult(query.getRecords(), (int) query.getPages(), (int) query.getCurrent(), (int) query.getSize());
            jsonResult.setData(pageResult);
            jsonResult.setCode(ResponseCode.SUCCESS);
        }catch (Exception ex){
            jsonResult.setCode(ResponseCode.ERROR);
            jsonResult.setMsg("没有相关数据");
            ex.printStackTrace();
        }
        return jsonResult;
    }
}

